package com.tuling.JUC;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.locks.LockSupport;

public class LockSuppartUtil {
    static Thread t1 = null;
    static Thread t2 = null;
    public static void main(String[] args) {
        char[] ai = "12345678".toCharArray();
        char[] in = "abcdefg".toCharArray();

        HashSet set = new HashSet();
        set.contains("x");

                t1 = new Thread(() ->{
            for(char a:ai){
                System.out.println(a);
                LockSupport.unpark(t2);
                LockSupport.park();
            }
        },"T1");

         t2 = new Thread(() ->{
            for(char i:in){
                System.out.println(i);
                LockSupport.unpark(t1);
                LockSupport.park();
            }
        },"T2");
        t1.start();
        t2.start();
    }
}
